//其它实用函数

//搜索框隐藏函数
function hidesearch(){
	if (searchhidded){
		document.getElementById("searchbar").style.display = "block";
		document.getElementById("navbar0").style.marginTop = "-1px";
		document.getElementById("arrowpic1").src = "/javascripts/dep_manage/images/arrow1.gif";
		document.all.tree.style.height=document.body.clientHeight-135;
		document.getElementById("arrowpic1").title = "隐藏搜索";
		searchhidded = false;
	}else{
		document.getElementById("searchbar").style.display = "none";
		document.getElementById("navbar0").style.marginTop = "0px";
		document.getElementById("arrowpic1").src = "/javascripts/dep_manage/images/arrow.gif";
		document.all.tree.style.height=document.body.clientHeight-109;
		document.getElementById("arrowpic1").title = "显示搜索";
		searchhidded = true;
	}
}
//树隐藏函数
function hidetree(){
	if (hidded){
		document.getElementById("nav").style.display = "";
		document.getElementById("navbar").style.marginLeft = "-2px";
		document.getElementById("arrowpic2").src = "/javascripts/dep_manage/images/arrow2.gif";
		document.getElementById("arrowpic2").title = "隐藏树";
		hidded = false;
	}else{
		document.getElementById("nav").style.display = "none";
		document.getElementById("navbar").style.marginLeft = "0px";
		document.getElementById("arrowpic2").src = "/javascripts/dep_manage/images/arrow3.gif";
		document.getElementById("arrowpic2").title = "显示树";
		hidded = true;
	}
}
//搜索框背景变换函数
function showH(show){
	var x = document.getElementById("thesearch").value;
	if (show==1) {
		document.all.thesearch.style.backgroundImage='url(/javascripts/dep_manage/images/input_bg0.gif)';
	}else{
		if(x=="")
		document.all.thesearch.style.backgroundImage='url(/javascripts/dep_manage/images/input_bg.gif)';
	}
}
//打开帮助
function toabout(){
	addtag("about","关于","help.gif");
	switchtag("about");
	var url = "inc/about.asp?timestamp="+ new Date().getTime();
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleaboutStateChange;
    xmlHttp.open("get",url,true);
    xmlHttp.send(null);
	document.all.topoperation.innerHTML = "关于";
}

function handleaboutStateChange() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
		var ajaxRequestObj = xmlHttp.responseText;
		document.all.about.innerHTML = ajaxRequestObj;
        }
    }
}

function building(){
	showmsg('a','新功能','开发中...');
}
//动态获取计数器计数
var curnum = 0;
function getSumNum(){
	createXMLHttpsRequest();
	var queryString = "inc/nowsum.asp";
	xmlHttps.onreadystatechange = handlegetnumStateChange;
	xmlHttps.open("GET",queryString, true);
	xmlHttps.send(null);
}

function handlegetnumStateChange() {
    if(xmlHttps.readyState == 4) {
        if(xmlHttps.status == 200) {
            var ajaxRequestObj = xmlHttps.responseText;
			if (curnum!=ajaxRequestObj){
				curnum = ajaxRequestObj;
				for (var i=0;i<ajaxRequestObj.length;i++){
					document.getElementById("versionnum").innerText=curnum;
					var v2 = document.getElementById("versionnum2");
					if (v2!=null)v2.innerText=curnum;
				}
			}
        }
    }
}
setInterval("getSumNum();",99999);

function addonclick(id){
	var hid=id+'tag';
	document.getElementById(hid).setAttribute("onclick","switchtag('"+id+"');");
	alert(document.getElementById(hid).onclick);
}
